package com.hanhai.material.device.entity;

import com.mybatisflex.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 *  实体类。
 *
 * @author youchuang
 * @since 2023/09/19 14:58:16
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "sys_machine_plc",dataSource = "device")
public class SysMachinePlc implements Serializable {

    /**
     * 机台ID
     */
    @Id(keyType = KeyType.Auto)
    private Integer id;

    /**
     * 机台代码
     */
    private String machineName;

    /**
     * 机台区域
     */
    private String machineArea;

    /**
     * 机台品牌
     */
    private String machineBrand;

    /**
     * 机台属性
     */
    private String machineProperties;

    /**
     * PLCID
     */
    private String plcDeviceId;

    private String machineId;

    private boolean hasWeight;

    private boolean hasTwoWeight;

    private String weightId1;

    private String weightId2;

    private boolean nowStatus;

    private BigDecimal nowWeight1;

    private BigDecimal nowWeight2;

    /**
     * 创建时间
     */
    @Column(onInsertValue = "now()")
    private Date createTime;

    /**
     * 创建人ID
     */

    private String createUserId;
    /**
     * 更新时间
     */
    @Column(onUpdateValue = "now()")
    private Date updateTime;
    /**
     * 更新人Id
     */
    private String updateUserId;

    @Column(ignore = true)
    private String productRecordId;

    @RelationOneToMany(selfField = "machineName",targetField = "machineName",extraCondition = "actual_start_time is not null and actual_end_time is null and (work_shop='成型车间' or work_shop='' or work_shop is null)",dataSource = "device")
    private List<SysProductRecord> productRecordList;

    private String lineManagerA;

    private String lineManagerB;

    private String technicianA;

    private String technicianB;

    private String autoTechnicianA;

    private String autoTechnicianB;

}
